#ifndef _BSP_TIMER_H_
#define _BSP_TIMER_H_

#include "debug.h"
#include <stdbool.h>

typedef struct {
    TIM_TypeDef*  TIMx;

    uint32_t               RCC_APBxPeriph_TIMy;
    void (*RCC_APBxPeriphClockCmd)(uint32_t RCC_APBxPeriph, FunctionalState NewState);

    uint16_t                TIM_Prescaler;
    uint16_t                TIM_CounterMode;
    uint16_t                TIM_Period;
    uint16_t                TIM_ClockDivision;
    uint8_t                 TIM_RepetitionCounter;

    uint16_t                TIM_FLAG;
    uint16_t                TIM_IT;

    uint32_t                NVIC_PriorityGroupx;
    uint8_t                 NVIC_IRQChannel;
    uint8_t                 NVIC_IRQChannelPreemptionPriority;
    uint8_t                 NVIC_IRQChannelSubPriority;
    FunctionalState         NVIC_IRQChannelCmd;


} BSP_Timer_TypeDef ;

void Timer_Init(BSP_Timer_TypeDef* t, bool ISR_Need);

#endif
